#ifndef _SPLINE_H_
#define _SPLINE_H_

#include<iostream>
#include<vector>
#include "Vec.h"
#include "InterConditions.h"
#include "Polynomial.h"
#include "Polynomial.cpp"
#include <lapacke.h>

//using namespace std;
using std::cout;
using std::endl;
using std::ostream;
using std::vector;
class InterConditions;

enum SplineType{ppForm,cardinalB};
enum BCType{complete,notAknot,periodic};
enum BCTYPE{cubic,quadratic};

template<int Dim,int Order,SplineType t>
class Spline
{
public:
	vector<double> T;

	vector<Polynomial<Order,double> > s; 
	vector<Polynomial<Order,Vec<double,2> > > s1;
public:
	Spline(){};
	Spline(int N);
	Spline(int N,vector<double> t1);
	Polynomial<4,double> B3(int i,int j);
	Polynomial<3,double> B2(int i,int j);
	template<int Ord> 
	friend Spline<2,Ord,ppForm> fitCurve(const vector<vector<double> > &p,BCType Type);
	template<int Ord>
	friend Spline<1,Ord,ppForm> interpolate(const InterConditions &p,BCType Type);
	template<int Ord>
	friend Spline<1,Ord,cardinalB> interpolate(const InterConditions &p,BCTYPE Type);
	double s_get_value(double x);
	Vec<double,2> s1_get_value(double x);
	double get_T(){return T[T.size()-1];}
	~Spline(){};
};















#endif
